﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace TimeReporter_II
{
    public class TaskObject
    {
       
        private int _taskID;
        private float _timeSpent;
        private string _userID;
        private DateTime _endDateTime;
        private DateTime _startDateTime;

        public TaskObject()
        {
        }

        public TaskObject(string importString)
        {
            char[] charArray = new char[] { ',' };

            //Extract the task data
            string[] theTask = importString.Split(charArray);

            _taskID = (int)Convert.ToDecimal(theTask[0]);
            //theTask[0].Trim();
            _timeSpent = (float)Convert.ToDouble(theTask[1]);
            _userID = theTask[2].Trim();
            _endDateTime = Convert.ToDateTime(theTask[3]);
            _startDateTime = Convert.ToDateTime(theTask[4]);
        }
        
        public int TaskId
        {
            get { return _taskID; }
            set { _taskID = value; }
        }

        public float TimeSpent
        {
            get { return _timeSpent; }
            set { _timeSpent = value; }
        }

        public string UserId
        {
            get { return _userID; }
            set { _userID = value; }
        }

        public DateTime EndDateTime
        {
            get { return _endDateTime.Date; }
            set { _endDateTime = value; }
        }

        public DateTime StartDateTime
        {
            get { return _startDateTime.Date; }
            set { _startDateTime = value; }
        }
        
    }
}
